package com.atguigu.gulimall.order.service.impl;

import com.atguigu.gulimall.order.entity.OrderDetail;
import com.atguigu.gulimall.order.mapper.OrderDetailMapper;
import com.atguigu.gulimall.order.service.OrderDetailService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author nicc
* @description 针对表【order_detail(订单明细表)】的数据库操作Service实现
* @createDate 2022-10-19 02:39:49
*/
@Service
public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, OrderDetail>
    implements OrderDetailService{

    @Autowired
    OrderDetailMapper detailMapper;

    @Override
    public List<OrderDetail> getOrderDetails(Long orderId, Long userId) {

        List<OrderDetail> details = detailMapper.selectList(new LambdaQueryWrapper<OrderDetail>()
                .eq(OrderDetail::getOrderId, orderId)
                .eq(OrderDetail::getUserId, userId)
        );

        return details;
    }
}




